﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CochinitaCorte
{ 
    using System.IO;
    using System.Xml.Linq;

	public partial class FtpParametros : Form
	{ 
		public FtpParametros()
		{
			InitializeComponent();
		}

		private void btnAceptar_Click(object sender, EventArgs e)
		{

            var objFTP = new[]
              {
                new 
                {
                    FtpHost =  txtFptHost.Text,
                    userName = txtUser.Text,
                    password = txtPassword.Text,
                    downloadPath = txtDownloadFiles.Text
                }
              };

            XElement xmlFTP = new XElement("FTP",
                                    from c in objFTP
                                    select new XElement("FTP",
                                     new XAttribute("FTPHOST", c.FtpHost),
                                     new XElement("user", c.userName),
                                     new XElement("pass", c.password),
                                     new XElement("folder", c.downloadPath)
                                     ));
            string test = xmlFTP.ToString();

            //param.FTPHost = txtFptHost.Text;
            //param.userName = txtUser.Text;
            //param.password = txtPassword.Text;
            //param.downloadPath = txtDownloadFiles.Text;

            //if (Directory.Exists(param.downloadPath)) Directory.Delete(param.downloadPath, true);
            //Directory.CreateDirectory(param.downloadPath);
			
            //mainProcess.SerializationObjet(param);

            Dispose();
		}

		private void btnCancelar_Click(object sender, EventArgs e)
		{
			this.Close();
		}

        private void FtpParametros_Load(object sender, EventArgs e)
        {
            BusinessLayer BL = new BusinessLayer();

            
            //param = new FtpParams();
            //param = mainProcess.UnSerializationObjet();

            //txtFptHost.Text= param.FTPHost;
            //txtUser.Text = param.userName;
            //txtPassword.Text = param.password;
            //txtDownloadFiles.Text = param.downloadPath;

        }
	}
}
